package cn.tedu.clubplus.controller;

import cn.tedu.clubplus.entity.Club;
import cn.tedu.clubplus.mapper.clubMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ClubController {
    @Autowired
    clubMapper mapper;
    @RequestMapping("/club/delete")
    public void delete(int id){
        mapper.deleteById(id);
    }
    @RequestMapping("/club/select")
    public List<Club> select(){
        System.out.println("111111111111111111111111111111111");
        System.out.println(mapper.select());
        return mapper.select();
    }
    @RequestMapping("/club/update")
    public void update(@RequestBody Club club){
        System.out.println("product = " + club);
        //调用mapper的update方法修改
        mapper.update(club);
    }
    @RequestMapping("/club/insert")
    public void insert(@RequestBody Club club){
        System.out.println("club = " + club);
        mapper.insert(club);
    }
}
